package priv.blackbibo.application.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import priv.blackbibo.application.activity.MainActivity;
import priv.blackbibo.application.activity.NoticeActivity;

/**
 * Created by black on 2019-12-08.
 */
public class CountDownStatusBroadCastReceiver extends BroadcastReceiver {
    private static final String TAG = "CountDownStatus";

    public CountDownStatusBroadCastReceiver() {
        super();
        Log.d(TAG, "CountDownStatusBroadCastReceiver: init");
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        boolean isStart = intent.getBooleanExtra("start",false);
        boolean isEnd = intent.getBooleanExtra("end",true);
        if (isStart){
            if (!isEnd){
                MainActivity.refreshUi();
            }else {
                MainActivity.noticeUserToDrink();
            }
        }
    }
}
